package com.boc.ewr.util.file.enumeration;

import lombok.extern.slf4j.Slf4j;

import java.util.Arrays;
import java.util.Optional;

/**
 * @author : Wzz
 * @create : 2023-06- 28- 15:55
 * @desc :补打账单投递方式
 */
@Slf4j
public enum SupplementDeliveryWayEnum {

    SEND("1", "对账小组直投客户"),
    DTD("0", "交由管辖机构对账人员上门对账");

    private String index;
    private String value;

    SupplementDeliveryWayEnum(String index, String value){

        this.index = index;
        this.value = value;
    }

    /**
     * 根据value获取枚举对象
     *
     * @param val
     * @return
     */
    public static SupplementDeliveryWayEnum getIndexByValue(String val) {
        Optional<SupplementDeliveryWayEnum> first = Arrays.stream(SupplementDeliveryWayEnum.values()).filter(e -> e.getValue().equals(val)).findFirst();
        SupplementDeliveryWayEnum expEnum = first.orElse(null);
        log.info("选择的枚举类型是：" + expEnum.toString());
        return expEnum;
    }

    public String getIndex() {
        return index;
    }

    public void setIndex(String index) {
        this.index = index;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }
}
